package com.biu.billiards.controller;
import com.biu.billiards.model.vo.shop.AddShopVo;
import com.biu.billiards.model.vo.shop.GetShopVo;
import com.biu.billiards.model.vo.shop.UpdateShopVO;
import com.biu.billiards.model.vo.withdraw.AddWithdrawVo;
import com.biu.billiards.response.BaseResponse;
import com.biu.billiards.response.RespGenerator;
import com.biu.billiards.service.IShopService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author xue
 * @since 2023-09-25
 */
@RestController
@RequestMapping()
public class ShopController {

    @Resource
    private IShopService shopService;

    @ApiOperation(value = "提现")
    @PostMapping("/autoWithdraw")
    public BaseResponse<Boolean> addWithdraw(@RequestBody AddWithdrawVo addWithdrawVo) {
        return RespGenerator.returnOK(shopService.autoWithdraw(addWithdrawVo));
    }


    @ApiOperation(value = "改变自动化状态")
    @PostMapping("/changeAutoStatus")
    public BaseResponse<Map<String,Object>> changeAutoStatus(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(shopService.changeAutoStatus(getShopVo));
    }


    @ApiOperation(value = "获取list店铺数据")
    @PostMapping("/getShopList")
    public BaseResponse<Map<String,Object>> getShopList(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(shopService.getShopList(getShopVo));
    }


    @ApiOperation(value = "获取单个店铺数据")
    @PostMapping("/getShop")
    public BaseResponse<Map<String,Object>> getShop(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(shopService.getShop(getShopVo));
    }

    @ApiOperation(value = "获取店铺数据")
    @PostMapping("/getShopPage")
    public BaseResponse<Map<String,Object>> getShopPage(@RequestBody GetShopVo getShopVo) {
        return RespGenerator.returnOK(shopService.getShopPage(getShopVo));
    }


    @ApiOperation(value = "修改店铺信息")
    @PutMapping("/updateShop")
    public BaseResponse<Boolean> updateShop(@RequestBody UpdateShopVO updateShopVO) {
        return RespGenerator.returnOK(shopService.updateShop(updateShopVO));
    }


    @ApiOperation(value = "新增店铺信息")
    @PostMapping("/addShop")
    public BaseResponse<Boolean> addShop(@RequestBody AddShopVo addShopVo) {
        return RespGenerator.returnOK(shopService.addShop(addShopVo));
    }


    @ApiOperation(value = "删除店铺信息")
    @DeleteMapping("/deleteShop")
    public BaseResponse<Boolean> deleteShop(@RequestParam("shopId") Integer shopId) {
        return RespGenerator.returnOK(shopService.deleteShop(shopId));
    }


}
